/*
* $Id: EditDraw.h 177 2010-10-27 12:31:26Z volok-aleksej@yandex.ru $
*
* Copyright 2009 by Volokitin Alexey
* All rights reserved
*
*/
#ifndef _EDIT_DRAW_H_
#define _EDIT_DRAW_H_

#include "DrawControl.h"
#include "LetterDraw.h"

class CEditorItem;

class CEditDraw : public CDrawControl
{
	int m_nBeginSel;
	int GetPointLetter(CPoint pos);
protected:
	CPoint m_posSel;
	int m_nPosCursor;
	std::vector<int> m_aSepLetterPos;
	std::vector<int> m_aLineBeginPos;
	std::vector<CLetterDraw> m_aLetters;
	CEditorItem* m_pParent;
protected:
	virtual void Resize();
	virtual void PaintActive(CDC* dc);
	virtual void PaintNonActive(CDC* dc);
	std::tstring GetNewString(std::tstring strAddString);
public:
	CEditDraw(const std::tstring& strName, CEditorItem* pParent);
	virtual ~CEditDraw();
public:
	virtual void SetPos(CPoint pos);
public:
	void SetSel(CPoint sel);
	CPoint GetSel();
	int GetPosCursor();
	void SetPosCursor(int posCursor);
	void OffsetCursor(int offset);
	int GetOffsetWord(bool bLeft);
	int GetOffsetLine(bool bUp);
	void AddString(const std::tstring& strValue);
	virtual void Delete(int pos);
	virtual void Delete(int begin, int end);
	virtual bool IsChar(int nChar);
	virtual void AddChar(int nChar);
	virtual bool ProcessMouse(unsigned int nChar, CPoint pos, int param);
};

class CNumberEditDraw : public CEditDraw
{
	bool Null(int pos);
public:
	CNumberEditDraw(const std::tstring& strName, CEditorItem* pParent);
	virtual ~CNumberEditDraw();
public:
	virtual bool IsChar(int nChar);
	virtual void AddChar(int nChar);
	virtual void Delete(int pos);
	virtual void Delete(int begin, int end);
};
class CDoubleEditDraw : public CEditDraw
{
	bool Null(int pos);
public:
	CDoubleEditDraw(const std::tstring& strName, CEditorItem* pParent);
	virtual ~CDoubleEditDraw();
public:
	virtual bool IsChar(int nChar);
	virtual void AddChar(int nChar);
	virtual void Delete(int pos);
	virtual void Delete(int begin, int end);
};

#endif/*_EDIT_DRAW_H_*/
